import axios from '../../http/http'
import * as api from '../../http/api'

const  state={
        dishList:[],//菜品表
        query:{
            currentPage:1,
            pageSize:5
        },
        total:0
};
const  mutations={
        dishData(state,obj){
            state.dishList = obj.info;
            state.total = obj.pager.totalSize;
            console.log(state.total)
        }
};
const actions={
    getMenu({commit}){
        return axios({
            url:api.menu,
            method:'get',
            params:this.query
        }).then(res=>{
            console.log(res.data);
            commit('dishData',res.data);
            return res.data
        }).catch(err=>{
            console.log(err)
        })
    }
};
export default {
    state,
    actions,
    mutations,
}
